

module.exports = function(lab){
    return {
        "@startPayment": function(session, { trans_id, subject, body, total_amount, action }) {
            if (session.currentMember) {
    
                if (session.wechat_kitty) {
                    
                    // 使用微信支付, 这里就是聚合支付入口
                    return lab[session.wechat_kitty.split(".").join("_")].payment.@startPayment(session, {
                        trans_id,
                        subject,
                        body,
                        total_amount, 
                        action,
                        wechat_id: session.wechat_openID,
                    });
    
                } else {
                    throw @lab.errors.not_support;
                }
                
            } else {
                throw @lab.errors.not_login;
            }
        } 
    }
}